<?php
// Copyright (C) 2005 Rod Roark <rod@sunsetsystems.com>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.

include_once($GLOBALS['fileroot']."/interface/globals.php");
include_once($GLOBALS["srcdir"] . "/api.inc");
include_once("lines.php");

function pupillometry_report($pid, $encounter, $cols, $id) {
	$query = "SELECT * FROM forms WHERE pid = $pid AND encounter = $encounter";
	$res = sqlStatement($query);
	while($row = sqlFetchArray($res)){
		$formsiid[] = $row['form_id'];
	}
	
		$where_clause = '';
		$query = "Select * FROM form_pupillometry WHERE ";
		foreach ( $formsiid as  $form_id){
			if( $where_clause !=''){
				$where_clause .= ' OR ';
				
			}
			$where_clause .= " forms_id = $form_id ";		
		}
		$query .= $where_clause . " order by scheduled ASC ";
		$res = sqlStatement($query);
		echo "<div>";
		echo "<span>Revisiones realizadas</span><br>";
		while($row = sqlFetchArray($res)){
			$revision = $row['scheduled'];
			switch($revision){
				case 1:
					echo "<span>- ". xl('Day 1-2') ." </span><br>";
					break;
				case 2:
					echo "<span>- ". xl('Week 1') ." </span><br>";
					break;
				case 3:
					echo "<span>- ". xl('Month 1') ." </span><br>";
					break;
				case 4:
					echo "<span>- ". xl('Month 3') ." </span><br>";
					break;
				case 5:
					echo "<span>- ". xl('Month 6') ." </span><br>";
					break;
				case 6:
					echo "<span>- ". xl('Month 9') ." </span><br>";
					break;
				case 7:
					echo "<span>- ". xl('Month 12') ." </span><br>";
					break;
				case 8:
					echo "<span>- ". xl('Month 24') ." </span><br>";
					break;
				case 9:
					echo "<span>- ". xl('Unscheduled') ." </span><br>";
					break;
			}
		}
		echo "</div>";
}
?> 
